# -*- coding:utf-8 -*-
import numpy as np
import os

class Opt:
    bert_path = '/home/lixin/work/recommend-huawei/Erlangshen-Longformer-110M'
    # bert_path = '/home/lixin/work/recommend-huawei/ernie-health-zh'
    embedding_dim = 768
    dropout_rate = 0.5
    gpu = 1
    hidden_size = 768
    data_path = '.'
    hightlight_path = './highlight_base.html'
    save_model_path = '/home/lixin/work/huawei-2022/hwcc2022/checkpoints/Erlangshen-Longformer-110M_MultiViewModel_None_seed_7_2022-11-12-20-38-48.pth'

    def __init__(self,args):
        self.output_path = args.output_path

        self.label_idx_path = os.path.join(self.data_path, "label2id.txt")
        self.entity_idx_path = os.path.join(self.data_path,'entity2id.txt')
        
        self.label_matrix_path = os.path.join(self.data_path,'label_label_matrix.npy')
        self.label_matrix = np.load(self.label_matrix_path)
        self.ent_label_matrix_path = os.path.join(self.data_path,'ent_label_matrix.npy') #[ent_num,label_num]
        self.ent_label_matrix = np.load(self.ent_label_matrix_path)

        self.label2id = {}
        with open(self.label_idx_path, "r", encoding="UTF-8")as f:
            for line in f:
                lin = line.strip().split()
                self.label2id[lin[0]] = len(self.label2id)
        self.id2label = []
        for label in self.label2id:
            self.id2label.append(label)

        self.entity2id = {}
        with open(self.entity_idx_path, "r", encoding="UTF-8")as f:
            for line in f:
                lin = line.strip().split()
                self.entity2id[lin[0]] = len(self.entity2id)

        self.class_num = len(self.label2id)
        self.entity_num= len(self.entity2id)

